//bls 3

datablock fxDTSBrickData(LogicGate_Pixel2x2_Data){
	brickFile = $LuaLogic::Path @ "bricks/blb/2x2pixelbrick.blb";
	category = "Logic Bricks";
	subCategory = "Outputs";
	uiName = "Pixel 2x2";
	iconName = $LuaLogic::Path @ "icons/Pixel 2x2";
	hasPrint = 1;
	printAspectRatio = "Logic";
	orientationFix = 0;
	
	isLogic = true;
	isLogicGate = true;
	isLogicInput = false;
	
	logicUIName = "Pixel 2x2";
	logicUIDesc = "4 Pixels glued together with one print, for better ghosting performance and brickcount.";
	
	logicUpdate = lualogic_readfile($LuaLogic::Path @ "bricks/outputs/pixel2x2-update.lua");
	
	numLogicPorts = 4;
	
	logicPortType       [0] = 1;
	logicPortPos        [0] = "0 -1 -3";
	logicPortDir        [0] = 2;
	logicPortCauseUpdate[0] = true;
	logicPortUIName     [0] = "BR";
	
	logicPortType       [1] = 1;
	logicPortPos        [1] = "0 1 -3";
	logicPortDir        [1] = 2;
	logicPortCauseUpdate[1] = true;
	logicPortUIName     [1] = "BL";
	
	logicPortType       [2] = 1;
	logicPortPos        [2] = "0 -1 1";
	logicPortDir        [2] = 2;
	logicPortCauseUpdate[2] = true;
	logicPortUIName     [2] = "TR";
	
	logicPortType       [3] = 1;
	logicPortPos        [3] = "0 1 1";
	logicPortDir        [3] = 2;
	logicPortCauseUpdate[3] = true;
	logicPortUIName     [3] = "TL";
};
lualogic_registergatedefinition("LogicGate_Pixel3_Data");

function LogicGate_Pixel2x2_Data::LuaLogic_Callback(%data, %brick, %state) {
	switch(%state) {
		case 0x0: %brick.setPrint(lualogic_getprint("color000"));
		case 0x1: %brick.setPrint(lualogic_getprint("pixel2x2_1"));
		case 0x2: %brick.setPrint(lualogic_getprint("pixel2x2_2"));
		case 0x3: %brick.setPrint(lualogic_getprint("pixel2x2_3"));
		case 0x4: %brick.setPrint(lualogic_getprint("pixel2x2_4"));
		case 0x5: %brick.setPrint(lualogic_getprint("pixel2x2_5"));
		case 0x6: %brick.setPrint(lualogic_getprint("pixel2x2_6"));
		case 0x7: %brick.setPrint(lualogic_getprint("pixel2x2_7"));
		case 0x8: %brick.setPrint(lualogic_getprint("pixel2x2_8"));
		case 0x9: %brick.setPrint(lualogic_getprint("pixel2x2_9"));
		case 0xA: %brick.setPrint(lualogic_getprint("pixel2x2_A"));
		case 0xB: %brick.setPrint(lualogic_getprint("pixel2x2_B"));
		case 0xC: %brick.setPrint(lualogic_getprint("pixel2x2_C"));
		case 0xD: %brick.setPrint(lualogic_getprint("pixel2x2_D"));
		case 0xE: %brick.setPrint(lualogic_getprint("pixel2x2_E"));
		case 0xF: %brick.setPrint(lualogic_getprint("space"));
	}
}
